package lab03;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class Test {
    public static void main(String[] args) throws FileNotFoundException {
        /**
         *
         *
         */
        BufferedReader reader = null;
        String path="D:\\旅院\\作业\\java"; //读取此文件的内容
        try {
            reader=new BufferedReader(new FileReader(path));

            String  line="";

            while ((line=reader.readLine())!=null){
           // for (int i=0;i<3;i++){
                //line=reader.readLine();
                //System.out.println(line);
           // }
                System.out.println(line);
            }

        } catch (FileNotFoundException e){
            e.printStackTrace();
        }catch (IOException e){
            e.printStackTrace();
        }finally {
            try {
                reader.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        //1.字符流来读

        reader = new BufferedReader(new FileReader(path));


        //2.字节流来读

    }
}
